package com.common.frame.utils

import android.app.Application

/**
 *
 * create by sunxy on 2020/8/13
 **/
object AppGlobals{

    @JvmStatic
    val application: Application by lazy {
        val method = Class.forName("android.app.ActivityThread").getMethod("currentApplication")
        method.invoke(null, *arrayOf()) as Application
    }

    fun dp2Px(dpValue: Int) =
        (application.resources.displayMetrics.density * dpValue + 0.5f).toInt()


}